]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Center overlay close button on border using guide actor
authorSebastian Keller <skeller@gnome.org>
Sun, 14 Jun 2020 04:23:33 +0000 (06:23 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Sun, 14 Jun 2020 21:58:47 +0000 (21:58 +0000)
This makes use of the invisible actor introduced in the previous commit
to center the close button on the border.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2899

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1313

js/ui/workspace.js

index 54cbb5e9fc15975ecf2bd4b35342b37a47983243..16b2c1b87b6ba12bc2fac2ca3058ba9b6bef1788 100644 (file)
@@ -337,17 +337,17 @@ var WindowClone = GObject.registerClass({
             child: new St.Icon({ icon_name: 'window-close-symbolic' }),
         });
         this._closeButton.add_constraint(new Clutter.BindConstraint({
-            source: this._border,
+            source: this._borderCenter,
             coordinate: Clutter.BindCoordinate.POSITION,
         }));
         this._closeButton.add_constraint(new Clutter.AlignConstraint({
-            source: this._border,
+            source: this._borderCenter,
             align_axis: Clutter.AlignAxis.X_AXIS,
             pivot_point: new Graphene.Point({ x: 0.5, y: -1 }),
             factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1,
         }));
         this._closeButton.add_constraint(new Clutter.AlignConstraint({
-            source: this._border,
+            source: this._borderCenter,
             align_axis: Clutter.AlignAxis.Y_AXIS,
             pivot_point: new Graphene.Point({ x: -1, y: 0.5 }),
             factor: 0,
@@ -417,7 +417,7 @@ var WindowClone = GObject.registerClass({
         const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
         const [, titleHeight] = this._title.get_preferred_height(-1);
 
-        const topOversize = this._borderSize + closeButtonHeight / 2;
+        const topOversize = (this._borderSize / 2) + (closeButtonHeight / 2);
         const bottomOversize = Math.max(
             this._borderSize,
             (titleHeight / 2) + (this._borderSize / 2));
@@ -430,11 +430,11 @@ var WindowClone = GObject.registerClass({
         const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
 
         const leftOversize = this._closeButtonSide === St.Side.LEFT
-            ? this._borderSize + closeButtonWidth / 2
+            ? (this._borderSize / 2) + (closeButtonWidth / 2)
             : this._borderSize;
         const rightOversize = this._closeButtonSide === St.Side.LEFT
             ? this._borderSize
-            : this._borderSize + closeButtonWidth / 2;
+            : (this._borderSize / 2) + (closeButtonWidth / 2);
 
         return [leftOversize, rightOversize];
     }